package 中顺序遍历二叉树;

import javax.swing.tree.TreeNode;
import java.util.ArrayList;
import java.util.List;
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(ieNnt val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, Treode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
public class Solution1 {
    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> res = new ArrayList<>();
        inorder(root,res);
        return res;
    }

    public void inorder(TreeNode root , List<Integer> res){
        if(root == null){
            return;
        }

        inorder(root.left,res);
        res.add(root.val);
        inorder(root.right,res);

    }


}
